﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CarRent.BL.Models
{
    public class EventInfo
    {
        public int ID { get; set; }
        public string Title { get; set; }
        public string Tip { get; set; }
        public DateTime? Start { get; set; }
        public DateTime? End { get; set; }
        public bool AllDay { get; set; }
        public string Url { get; set; }

        public EventInfo()
        {
            AllDay = true;
        }

        public EventInfo(CarRent.DAL.Booking booking, string carName)
        {
            ID = booking.BookingID;
            Title = booking.User == null ? carName : booking.User.FullName;
            Start = booking.FromDate;
            End = booking.ToDate;
            AllDay = false;
            StringBuilder builder = new StringBuilder();
            if (booking.User != null)
            {
                builder.AppendFormat("Request for: {0}", booking.User.FullName ?? "Unknown");
                builder.AppendLine();
            }
            builder.AppendFormat("Car model: {0}", carName);
            builder.AppendLine();
            builder.AppendFormat("From date: {0}, To date: {1}", booking.FromDate, booking.ToDate);
            builder.AppendLine();
            builder.AppendFormat("Destination: {0}", booking.Destination);
            builder.AppendLine();
            builder.AppendFormat("Purpose: {0}", booking.Purpose);
            builder.AppendLine();
            builder.AppendFormat("Remark: {0}", booking.Remark);
            builder.AppendLine();
            builder.AppendFormat("Start (KM): {0}, End (KM): {1}", booking.StartKm, booking.EndKm);
            builder.AppendLine();
            builder.AppendFormat("Depart time: {0}", booking.DepartTime);
            builder.AppendLine();
            builder.AppendFormat("Arrival time: {0}", booking.ArrivalTime);
            builder.AppendLine();
            builder.AppendFormat("Admin remark: {0}", booking.Remark);

            Tip = builder.ToString();
        }
    }
}
